package io.renren.modules.basic.controller;

import java.util.Arrays;
import java.util.Map;

import io.renren.modules.basic.entity.MtCcCategoryEntity;
import io.renren.modules.basic.service.MtCcCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author
 * @date 2020-08-31 09:36:39
 */
@Api(tags = "")
@RestController
@RequestMapping("generator/mtcccategory")
public class MtCcCategoryController {
    @Autowired
    private MtCcCategoryService mtCcCategoryService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @ApiOperation(value = " 列表",notes = "")
    @RequiresPermissions("generator:mtcccategory:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = mtCcCategoryService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @ApiOperation(value = "根据ID查询详情",notes = "")
    @RequiresPermissions("generator:mtcccategory:info")
    public R info(@PathVariable("id") Integer id){
		MtCcCategoryEntity mtCcCategory = mtCcCategoryService.getById(id);

        return R.ok().put("mtCcCategory", mtCcCategory);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @ApiOperation(value = "新增",notes = "")
    @RequiresPermissions("generator:mtcccategory:save")
    public R save(@RequestBody MtCcCategoryEntity mtCcCategory){
		mtCcCategoryService.save(mtCcCategory);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @ApiOperation(value = "修改",notes = "")
    @RequiresPermissions("generator:mtcccategory:update")
    public R update(@RequestBody MtCcCategoryEntity mtCcCategory){
		mtCcCategoryService.updateById(mtCcCategory);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @ApiOperation(value = "删除",notes = "")
    @RequiresPermissions("generator:mtcccategory:delete")
    public R delete(@RequestBody Integer[] ids){
		mtCcCategoryService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
